The functions described here are used in implementing interactive Calc commands. Note that this list is not exhaustive! If there is an existing command that behaves similarly to the one you want to define, you may find helpful tricks by checking the source code for that command.
Set the command flag flag. This is generally a Lisp symbol, but may in fact be anything. The effect is to add flag to the list stored in the variable
calc-command-flags, unless it is already there. See Defining Simple Commands.
If flag appears among the list of currently-set command flags, remove it from that list.
Add the “undo record” rec to the list of steps to take if the current operation should need to be undone. Stack push and pop functions automatically call
calc-record-undo, so the kinds of undo records you might need to create take the form ‘(set sym value)’, which says that the Lisp variable sym was changed and had previously contained value; ‘(store var value)’ which says that the Calc variable var (a string which is the name of the symbol that contains the variable's value) was stored and its previous value was value (either a Calc data object, ornilif the variable was previously void); or ‘(eval undo redo args ...)’, which means that to undo requires calling the function ‘(undo args ...)’ and, if the undo is later redone, calling ‘(redo args ...)’.
Record the error or warning message msg, which is normally a string. This message will be replayed if the user types w (
calc-why); if the message string begins with a ‘*’, it is considered important enough to display even if the user doesn't type w. If one or more args are present, the displayed message will be of the form, ‘msg: arg1, arg2, ...’, where the arguments are formatted on the assumption that they are either strings or Calc objects of some sort. If msg is a symbol, it is the name of a Calc predicate (such asintegerpornumvecp) which the arguments did not satisfy; it is expanded to a suitable string such as “Expected an integer.” Thereject-argfunction callscalc-record-whyautomatically; see Predicates.